<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
        }

        body {
            height: 3000px;
        }

        .nav {
            opacity: 0;
            width: 60px;
            height: 200px;
            border: 1px solid black;
            position: fixed;
            right: 100px;
            top: 100px;
            transition: all 0.5s;
        }



        .nav ul li {
            height: 50px;
            /* flex: 1; */
            background-color: #c1c1c1;
        }
    </style>
</head>

<body>
    <div class="nav">
        <ul>
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
        </ul>
    </div>

    <script>

        window.addEventListener('scroll', function () {
            const i = document.documentElement.scrollTop
            console.log(i);
            if (i >= 180) {
                document.querySelector('.nav').style.opacity = 1
            }

            else {
                document.querySelector('.nav').style.opacity = 0
            }
        })
    </script>
</body>

</html>